package com.xinnet.mms.goods.dao.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Repository;

import com.xinnet.mms.allot.dao.impl.BaseDaoImpl;
import com.xinnet.mms.entity.Goods;
import com.xinnet.mms.entity.Product;
import com.xinnet.mms.goods.dao.GoodsDao;

@Repository("goodsDao")
public class GoodsDaoImpl extends BaseDaoImpl<Object,Object> implements GoodsDao {

	/**
	 * 
	 * 从商品中心取得所有product_class
	 */
	@Override
	public List<Product> getProductClassFromGoodsCenter() throws SQLException {
		return this.getSqlSession().selectList("goods.getProductClassFromGoodsCenter");
	}

	/**
	 * 根据商品codes获取商品
	 */
	@Override
	public Goods getGoodsByGoodsCodes(String goodsCodes) throws SQLException {
		return this.getSqlSession().selectOne("goods.getGoodsByGoodsCodes");
	}

	/**
	 * 根据会员ID获取该会员所有的购物车商品顶级分类
	 */
	@Override
	public List<Product> getProductClassByCusId(String cusId) throws SQLException {
		return this.getSqlSession().selectList("goods.getProductClassByCusId",cusId);
	}
	
}
